package com.acme.bankapp.domain.bank;


public abstract class AbstractAccount implements Account {
	protected final String NEGATIVE_VALUE = "Amount cant be negative";
	protected final String NOT_ENOUGH_FOUNDS = "Not enough founds";
	protected int id;
	protected double balance;

	public AbstractAccount(final double amount) throws NegativeArgumentValueException {
		if (amount < 0)
			throw new NegativeArgumentValueException(NEGATIVE_VALUE);
		this.balance = amount;
	}

	public double getBalance() {
		return balance;
	}

	protected void setBalance(final double balance) {
		this.balance = balance;
	}
	
	public void deposit(final double amount) throws NegativeArgumentValueException {
		if (amount < 0) {
			throw new NegativeArgumentValueException(NEGATIVE_VALUE);
		}
		setBalance(balance + amount);
	}
}
